/*
 * Created on Apr 3, 2006
 *
 */
package ar.edu.utn.frba.gdaia.src.junittest;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

import junit.framework.TestCase;
import ar.edu.utn.frba.gdaia.src.action.Command;
import ar.edu.utn.frba.gdaia.src.action.ReadWordsCommand;
import ar.edu.utn.frba.gdaia.src.domain.Canal;
import ar.edu.utn.frba.gdaia.src.domain.ConceptoElemental;
import ar.edu.utn.frba.gdaia.src.main.Cerebro;
import ar.edu.utn.frba.gdaia.src.main.GDAIA;
import ar.edu.utn.frba.gdaia.src.util.ListBuilder;

/**
 * @author Patricio, Juan P, Fernando
 */
public class ReadWordsCommand2Test extends TestCase {

	public static void main(String[] args) {
		junit.swingui.TestRunner.run(ReadWordsCommand2Test.class);
	}

	Cerebro cerebro = null;

	GDAIA gdaia = new GDAIA();

	Map parameters = null;

	/*
	 * @see TestCase#setUp()
	 */
	protected void setUp() throws Exception {
		super.setUp();
		// genero el cerebro a partir del XML
		cerebro = gdaia.generateCerebroFromXML();
		parameters = new HashMap();
		List palabras = new ListBuilder().add("HOLA").add("JUAN").get();
		parameters.put(Command.CEREBRO, cerebro);
		// parameters.put(Command.PALABRAS,palabras);
		cerebro.setListaDePalabrasLeidas(palabras);
	}

	/*
	 * @see TestCase#tearDown()
	 */
	protected void tearDown() throws Exception {
		super.tearDown();
		gdaia.generateXMLForCerebro(cerebro);
	}

	/**
	 * Constructor for ReadWordsCommandTest.
	 * 
	 * @param arg0
	 */
	public ReadWordsCommand2Test(String arg0) {
		super(arg0);

	}

	public final void testExecute() {
		new ReadWordsCommand().execute(parameters);
		boolean ret = cerebro.getConceptos().contains(
				new ConceptoElemental(1, "SOY", Canal.TECLADO));
		assertTrue(ret);

	}

}
